function [dstr, a] = parse_line(str)
% parse_line - change the contents of the line so that all spaces are compacted to single,
% then return pointers to each space-delimited token
% 11/98 pbm
%
j=1;
dstr = [];
nspc=0;
% this is the deblanking routine (makes ONE blank for each group thereof)
str=deblank(str);
dstr(j)=' ';
j=j+1;
for i=1:length(str)
   if(strcmp(str(i), ' '))
      nspc = nspc+1;
   else
      if(nspc > 0)
         dstr(j)=' '; % put in one space
         j=j+1;
         dstr(j)=str(i); % copy over the character
         j=j+1;
         nspc=0;	% reset space counter
      else
         dstr(j)=str(i); % no spaces - just copy over
         j=j+1;
      end
   end
end
% now get the token list
a=findstr(dstr, ' ');
return;
